<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title><spring:message code="head.clothGarment"></spring:message></title>
    <link href="${pageContext.request.contextPath }/phone/css/main.css" rel="stylesheet" />
    <style type="text/css">

	#banner_list{
		position:relative;
		width:100%;
		min-height:160px;
	}
	#banner_list img{
		position:absolute;
		left:0px;
		top:0px;
		width:100%;
		height:100%;
	}

</style>
</head>
<body>
    <div>
        <!--首页的标题栏-->
        <jsp:include page="head.jsp"></jsp:include>
        <!--广告图-->
        <div role="main" class="main" style="margin-top:50px;margin-bottom:90px;">
        <!--banner begin-->
		<div class="banner_lun">			
			<div class="slider" id="banner_list" e-fun="slider">
			 <c:forEach items="${shufflingFigures }" var="shuff" varStatus="t">	  
	            <a href="${pageContext.request.contextPath }/api/information/informationDetails?id=${shuff.sfMessage1}" ><img src="${pageContext.request.contextPath }/upload/${shuff.sfUrl}"  alt=""/></a> 	   		          
             </c:forEach>				  	
		    </div>			
		</div>
           <!-- 花型主题 开始 -->
            <c:if test="${not empty themeList }">
            <div class="sdiv3">
                <div class="top">
                	<span class="title le"><spring:message code="pattern.pattern"></spring:message><spring:message code="pattern.theme"></spring:message></span>
                	<span class="ri">
                	   <a href="${pageContext.request.contextPath }/api/theme/main"><spring:message code="more"></spring:message>></a>
               		</span>
               	</div>
                <div class="content">
                    <div class="xdkz">
                        <ul>
	                        <c:forEach items="${themeList }" var="theme" varStatus="t">
	                        <c:if test="${t.index<4 }">
	                            <li>
	                            	<a href="${pageContext.request.contextPath }/api/theme/details?id=${theme.id}">
	                            		<img src="${pageContext.request.contextPath }/upload/compression/${theme.img }" />
	                            		<span>${theme.name }</span>
	                           		</a>
	                       		</li>
                       		</c:if>
	                        </c:forEach>
                            <div class="clr"></div>
                        </ul>
                    </div>
                </div>
            </div>
            </c:if>
            <!-- 花型主题 结束 -->
            
            <!-- 试衣间 开始 -->
            <div class="sdiv3">
            	<div class="shiyi_img">
            		<a href="javascript:fittingRoom();">
            			<img src="${pageContext.request.contextPath }/phone/img/shiyijian.gif"/>
           			</a>
       			</div>
            </div>
            <!-- 试衣间 结束 -->
            
            <!-- 秀场同步 开始 -->
            <div class="sdiv3">
            	<div class="top">
            		<span class="title le"><spring:message code="index.show"></spring:message></span>
            		<span class="ri">
            			<a href="${pageContext.request.contextPath }/api/show/showFieldList"><spring:message code="more"></spring:message>&gt;</a>
            		</span>
            	</div>
                <div class="content">
                	<div class="xc">
                		<div class="xc_div">
                			<c:set var="c" value="0"></c:set>
                			<ul class="xch_ul">
	                			<c:forEach items="${showList }" var="s" varStatus="show">
	                				<c:if test="${s.parentId==0 }">
		                				<li <c:if test="${c==0 }">class="on"</c:if>>${s.name }</li>
		                				<c:set var="c" value="${c+1 }"></c:set>
						            </c:if>
					            </c:forEach>
	                			<div class="clr"></div>
	                		</ul>
                		</div>
                		
                		<div class="xiuc">
                		<c:set var="c1" value="0"></c:set>
			            <c:forEach items="${showList }" var="s1">
			            	<c:if test="${s1.parentId==0 }">
			            		<c:set var="c3" value="0"></c:set>
			            		<c:forEach items="${showList }" var="s2" varStatus="show2">
		            				<c:if test="${s2.parentId == s1.id }">
		            					<c:set var="c3" value="${c3+1 }"></c:set>
	                				</c:if>
		            			</c:forEach>
			            	
	                			<ul <c:if test="${c1!=0 }">class="hide"</c:if> style="<c:if test="${c3>6 }">overflow-y:hidden;</c:if>">
	                			<c:forEach items="${showList }" var="s2" varStatus="show">
		            				<c:if test="${s2.parentId == s1.id }">
	                					<li><a href="${pageContext.request.contextPath }/api/show/showFieldList">${s2.name }</a></li>
	                				</c:if>
		            			</c:forEach>
	                			</ul>
                				<c:set var="c1" value="${c1+1 }"></c:set>
			            	</c:if>
			            </c:forEach>
                		</div>
                	</div>
                </div>
            </div>
            <!-- 秀场同步 结束 -->
            
            <!--版布开发 开始-->
            <c:if test="${not empty bbList }">
            <div class="sdiv3">
                <div class="top">
                	<span class="title le"><spring:message code="index.fabricDev"></spring:message></span>
                	<span class="ri">
                		<a href="${pageContext.request.contextPath }/api/fabric/cloth/all"><spring:message code="more"></spring:message>></a>
               		</span>
           		</div>
                <div class="content">
                    <div class="shdq">
                        <ul>
	                        <c:forEach items="${bbList }" var="bb">
	                            <li>
	                            	<a href="${pageContext.request.contextPath }/api/fabric/detail?fId=${bb.fId}">
	                            		<img src="${pageContext.request.contextPath }/upload/compression/${bb.image }" />
                            		</a>
                           		</li>
	                        </c:forEach>
                            <div class="clr"></div>
                        </ul>
                    </div>
                </div>
            </div>
            </c:if>
            <!--版布开发sdiv3-->
            <!--版布开发 结束-->
            
            <!--开发样本 begin-->
            <c:if test="${not empty ybList }">
            <div class="sdiv4">
                <div class="top">
                	<span class="title le"><spring:message code="developmentSamples"></spring:message></span>	
                	<span class="ri">
                		<a href="${pageContext.request.contextPath }/api/fabric/sample/all"><spring:message code="more"></spring:message>></a>
               		</span>
           		</div>
                <div class="content">
                    <div class="kfyb">
                        <ul>
	                        <c:forEach items="${ybList }" var="yb" varStatus="y" >
								<c:if test="${y.index<3 }">
	                            	<li>
	                            		<a href="${pageContext.request.contextPath }/api/fabric/detail?fId=${yb.fId}">
	                            			<img src="${pageContext.request.contextPath }/upload/compression/${yb.image }" />
	                            			<span>${yb.fName }</span>
                            			</a>
                           			</li>
	                            </c:if>
                            </c:forEach>
                            <div class="clr"></div>
                        </ul>
                    </div>
                </div>
            </div>
            </c:if>
            <!--开发样本sdiv4-->
            <!--开发样本 end-->
            
            <!--最新花型begin-->
            <c:if test="${not empty pList }">
            <div class="sdiv3">
                <div class="top">
                	<span class="title le"><spring:message code="index.pattern"></spring:message></span>
                	<span class="ri">
                		<a href="${pageContext.request.contextPath }/api/pattern/all/flowertypecatalog1"><spring:message code="more"></spring:message>></a>
               		</span>
           		</div>
                <div class="content">
                    <div class="shdq">
                        <ul>
	                        <c:forEach items="${pList }" var="p">
	                            <li>
	                            	<a href="javascript:xiangqing('${p.isVip}','${p.pId}')">
	                            		<img src="${imgpath }${p.pImg }" />
                            		</a>
                            		<c:if test="${p.isVip==2 }">
			        					<span >VIP</span>
			        				</c:if>
                           		</li>
                            </c:forEach>
                            <div class="clr"></div>
                        </ul>
                    </div>
                </div>
            </div>
            </c:if>
            <!--最新花型sdiv3-->
            <!--最新花型end-->
            
            <div class="vip_div">	
                <img src="${pageContext.request.contextPath }/phone/img/vip_icon.jpg" />
                <div class="vip_link">
                    <a onclick="toVipInfoPage()" href="javascript:void(0)"><spring:message code="vipExplain"></spring:message></a>
                    <a onclick="toVipPage()" href="javascript:void(0)"><spring:message code="applyForVip"></spring:message></a>
                </div>
            </div>
        </div>
        <jsp:include page="bottom.jsp" flush="true"><jsp:param name="bottom" value="1"/></jsp:include>
   </div>
    <script src="${pageContext.request.contextPath }/phone/js/extra.js"></script>
    
	    
	<!-- 轮播js -->
	<script type="text/javascript" src="${pageContext.request.contextPath }/phone/js/banner/common.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/phone/js/banner/simba.website.js"></script>
    
    
    
    <%-- <script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/layer/2.1/layer.js"></script> --%>
    <script type="text/javascript">
    
  	//跳转到vip说明页面
	function toVipInfoPage(){
		window.location.href='${pageContext.request.contextPath }/api/help/vipInfo';
	}
  	
	//跳转到vip页面
	function toVipPage(){
		var flag=validateVip();
		if(flag==0){     //如果是vip用户，则弹窗提示用户已经是vip用户，不能再次申请。
			//layer.msg('<spring:message code="index.VipUser"></spring:message>',{icon:0,time:1000});
			layer.open({
			    content: '<spring:message code="index.VipUser"></spring:message>'
			    ,skin: 'msg'
			    ,time: 1 //1秒后自动关闭
			  });
		}else if(flag==2){    //如果不是vip用户，跳转到vip用户申请界面
			window.location.href='${pageContext.request.contextPath }/api/toPhonePage/applyForVip';
		}else if(flag==1){    //用户未登录，直接跳转至登录页
			layer.open({
			    content: '<spring:message code="flowertypecatalog.notLogin"></spring:message>'
			    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
			    ,yes: function(index){
			    	window.location.href="${pageContext.request.contextPath }/api/member/exit";
			      layer.close(index);
			    }
			  });
		}
	}
	
	//校验用户是否为vip用户
	function validateVip(){
		var status=1;
		$.ajax({
			async:false,
			url:'${pageContext.request.contextPath }/web/vip/validateVip',
			type:'post',
			success:function(result){
				status=result.msg.status;
			}
		});
		return status;
	}
    
  	//试衣间
    function fittingRoom(){
    	$.ajax({  
    		type : "POST",  
             url : "${pageContext.request.contextPath }/web/member/isLogin",
             success: function(data) {
            	 if(data){
            		 window.location.href="${pageContext.request.contextPath }/api/pattern/goFittingRoom";
            	 }else{
            		 var href ="${pageContext.request.contextPath }/api/toPhonePage/login?redirectUrl=" + encodeURIComponent("${pageContext.request.contextPath }/api/pattern/goFittingRoom");
            		 
            		 layer.open({
         			    content: '<spring:message code="head.notLogin"></spring:message>'
         			    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
         			    ,yes: function(index){
         			    	location.href = href;
         			      layer.close(index);
         			    }
         			  });
            		 
            	 }
             }
    	});
    }
  	

  	
    function xiangqing(vip,patternId){
		if(vip==2){
			$.ajax({url:'${pageContext.request.contextPath }/web/patternfilter/judge', async : false,type : "POST",  success :function(result){
   			 var status=result.msg.status;
   			 var desc=result.msg.desc;
   			    if(status == 1){//没登录
   			    	layer.open({
   	       			    content: '<spring:message code="flowertypecatalog.notLogin"></spring:message>'
   	       			    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
   	       			    ,yes: function(index){
   	       			    	location.href="${pageContext.request.contextPath}/api/toPhonePage/login";
   	       			      layer.close(index);
   	       			    }
   	       			  });
   			    	flag=true;
   			    }else if(status ==2){
   			    	layer.open({
   	       			    content: '<spring:message code="flowertypecatalog.applyForVIP"></spring:message>'
   	       			    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
   	       			    ,yes: function(index){
   	       			    	location.href="${pageContext.request.contextPath}/api/toPhonePage/applyForVip";
   	       			      layer.close(index);
   	       			    }
   	       			  });
   			    	
   			    }else{
   			    	top.location.href='${pageContext.request.contextPath}/api/toPhonePage/patternShiyi?id='+patternId;
   			    }
   		  	}
			});
			}else{
				$.ajax({url:'${pageContext.request.contextPath }/web/patternfilter/judge', async : false,type : "POST",  success :function(result){
		   			 var status=result.msg.status;
		   			 var desc=result.msg.desc;
		   			    if(status == 1){//没登录
		   			    	layer.open({
		   	       			    content: '<spring:message code="flowertypecatalog.notLogin"></spring:message>'
		   	       			    ,btn: ['<spring:message code="reciveAddress.confirm"></spring:message>', '<spring:message code="reciveAddress.cancel"></spring:message>']
		   	       			    ,yes: function(index){
		   	       			    	location.href="${pageContext.request.contextPath}/api/toPhonePage/login";
		   	       			      layer.close(index);
		   	       			    }
		   	       			  });
		   			    	
		   			    }else{
		   			    	top.location.href='${pageContext.request.contextPath}/api/toPhonePage/patternShiyi?id='+patternId;
		   			    }
			}
		});
			}
		
	}
  	
    </script>

</body>
</html>
